package com.yz.design.strategyAndChain;

import lombok.Getter;

/**
 * @author 广长
 * @version V1.0
 * @className ReceiptHandleStrategyEnum
 * @description 解析报文枚举
 * @date 2020/11/05
 **/
@Getter
public enum ReceiptHandleStrategyEnum {
    CLUE_TASK(1, "MT1101", "com.yz.design.strategy.Mt1101ReceiptHandleStrategy"),
    CUSTOMER_TASK(2, "MT2101", "com.yz.design.strategy.Mt2101ReceiptHandleStrategy"),
    VISIT_TASK(3, "MT8104", "com.yz.design.strategy.Mt8104ReceiptHandleStrategy");

    private Integer key;
    private String desc;
    private String servicePath;

    ReceiptHandleStrategyEnum(Integer key, String desc, String servicePath) {
        this.key = key;
        this.desc = desc;
        this.servicePath = servicePath;
    }

    ReceiptHandleStrategyEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static ReceiptHandleStrategyEnum get(Integer key) {
        for (ReceiptHandleStrategyEnum e : ReceiptHandleStrategyEnum.values()) {
            if (e.getKey().equals(key)) {
                return e;
            }
        }
        throw new IllegalArgumentException(String.format("%s is not a valid value for %s", key, ReceiptHandleStrategyEnum.class));
    }

    public static boolean isInclude(int key) {
        boolean include = false;
        for (ReceiptHandleStrategyEnum e : ReceiptHandleStrategyEnum.values()) {
            if (e.getKey().equals(key)) {
                include = true;
                break;
            }
        }
        return include;
    }

}
